<html>
<head><meta charset="utf-8"><title>dot completions with subfields · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/dot.20completions.20with.20subfields.html">dot completions with subfields</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="196306822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/dot%20completions%20with%20subfields/near/196306822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Coenen Benjamin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/dot.20completions.20with.20subfields.html#196306822">(May 05 2020 at 13:25)</a>:</h4>
<p>Hello <span class="user-mention" data-user-id="133169">@matklad</span> I'm currently thinking about add subfields for dot autocompletion. For example  if I have this kind of struct</p>
<div class="codehilite"><pre><span></span><code><span class="k">struct</span> <span class="nc">A</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">      </span><span class="n">b</span>: <span class="nc">B</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">B</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">     </span><span class="n">my_number</span>: <span class="kt">usize</span>
<span class="p">}</span><span class="w"></span>

<span class="c1">// autocomplete</span>
<span class="kd">let</span><span class="w"> </span><span class="n">my_struct_a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">A</span><span class="p">{</span><span class="o">..</span><span class="p">.};</span><span class="w"></span>

<span class="kd">let</span><span class="w"> </span><span class="n">my_number</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">my_struct_a</span><span class="p">.</span><span class="o">&lt;|&gt;</span><span class="w"></span>

<span class="c1">// and then it lists autocompletions for b.my_number</span>
<span class="c1">// I think to put a depth of 3 to have some kind of a.b.c completion.</span>
</code></pre></div>


<p>In GoPLS they provide this kind of completion and it's often pretty useful. Do you think it could be a good idea ?</p>



<a name="196307004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/dot%20completions%20with%20subfields/near/196307004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/dot.20completions.20with.20subfields.html#196307004">(May 05 2020 at 13:26)</a>:</h4>
<p>Yeah, I think we should do smart completion eventually, but probably not right now</p>



<a name="196307031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/dot%20completions%20with%20subfields/near/196307031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/dot.20completions.20with.20subfields.html#196307031">(May 05 2020 at 13:26)</a>:</h4>
<p>The pre-requsite is having robust and correct ordering implemented</p>



<a name="196307100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/dot%20completions%20with%20subfields/near/196307100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/dot.20completions.20with.20subfields.html#196307100">(May 05 2020 at 13:27)</a>:</h4>
<p>we don't have that yet. Adding smart variants if some of the dumb variants are wrog/wrongly orderd could be a net negative</p>



<a name="196307808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/dot%20completions%20with%20subfields/near/196307808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Coenen Benjamin <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/dot.20completions.20with.20subfields.html#196307808">(May 05 2020 at 13:32)</a>:</h4>
<p>Ok thanks :) BTW I answered to this issue <a href="https://github.com/rust-analyzer/rust-analyzer/issues/4317" title="https://github.com/rust-analyzer/rust-analyzer/issues/4317">https://github.com/rust-analyzer/rust-analyzer/issues/4317</a> maybe I don't understand something.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>